package com.pengliu.common.exception;

import java.util.Map;
/**
 * user: pengliu
 * date: 2017年10月17日
 * desc:
 * @author pengliu
 */
public class ServiceException extends Exception{
	
	private static final long serialVersionUID = -5994758328909391197L;

	private Integer errorCode;
	
	private String message;
	
	private Map<String,Object> errorMapObject;
	
	public ServiceException(ExceptionEnums exceptionEnums , Map<String,Object> errorMapObject) {
		this.errorCode = exceptionEnums.getCode();
		this.message = exceptionEnums.getMessage();
		this.errorMapObject = errorMapObject;
	}
	
	public ServiceException(ExceptionEnums exceptionEnums) {
		this.errorCode = exceptionEnums.getCode();
		this.message = exceptionEnums.getMessage();
	}
	
	public ServiceException(Integer errorCode, String message) {
		this.errorCode = errorCode;
		this.message = message;
	}
	
	public ServiceException(String message) {
		this.errorCode = ExceptionEnums.FAIL.getCode();
		this.message = message;
	}

	public Object getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(Integer errorCode) {
		this.errorCode = errorCode;
	}

	@Override
	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Map<String, Object> getErrorMapObject() {
		return errorMapObject;
	}

	public void setErrorMapObject(Map<String, Object> errorMapObject) {
		this.errorMapObject = errorMapObject;
	}
}
